package com.zhangxun.exception;

import com.zhangxun.domain.AjaxResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 统一异常处理
 */
@RestControllerAdvice
public class GlobalExceptionHandle {


    @ExceptionHandler(NullPointerException.class)
    public AjaxResult NPTException(NullPointerException e){
        return AjaxResult.error(e.getMessage());
    }
}
